using System.Collections;

namespace ConsoleApp2.input._1016;

public class Demo
{
    public void TestPrint()
    {
        int max = 0;
        Console.WriteLine("请输入三个整数数字:");
        int[] pn = new int[3];
        for (int i = 0; i < 3; i++)
        {
            pn[i] = Convert.ToInt32(Console.ReadLine());
        }
        max = pn.Max();
        Console.WriteLine(max);
    }

    public void TestPrint2()
    {
        int sum = 0;
        for (int i = 1; i <= 100; i++)
        {
            if (!(i % 7 == 0 && i / 10 == 0 || i == 7))
            {
                sum += i;
            }
        }
        Console.WriteLine("1到100之间不含7的倍数的和为：" + sum);
    }

    public void TestPrint3()
    {
        for (int i = 1; i <= 9; i++)
        {
            for (int j = 1; j <= i; j++)
            {
                Console.Write("{0}*{1}={2}\t",j,i,j*i);
            }
        }
    }

    public void TestPrint4()
    {
        List<int> list = new List<int>();
        int sum = 0;
        for (int i = 2; i <= 1000; i++)
        {
            sum = 0;
            for (int j = 1; j < i; j++)
            {
                if (i%j == 0)
                {
                    list.Add(j);
                }
            }

            for (int j = 0; j < list.Count; j++)
            {
                sum += list[j];
            }

            list.Clear();

            if (sum ==i)
            {
                Console.WriteLine(i);
            }

        }
    }
    public void TestPrint5()
    {
        int a = Convert.ToInt32(Console.ReadLine());
        char[] chars = a.ToString().ToCharArray();
        for (int i = chars.Length-1; i > 0; i--)
        {
            Console.Write(chars[i]);
        }
        Console.Write(chars.Length);
    }

    public void TestPrint6()
    {
        int n;
        Console.WriteLine("请输入一个奇数：");
        n = Convert.ToInt32(Console.ReadLine());

        for (int j = 1; j <= (n + 1) / 2; j++)
        {
            // 打印前导空格
            for (int i = 1; i <= (n + 1) / 2 - j; i++)
                Console.Write(" ");

            // 打印星号
            for (int k = 1; k <= 2 * j - 1; k++)
                Console.Write("*");

            Console.WriteLine();
        }

        for (int k = (n+1)/2-1; k >= 1; k--)
        {
            for (int s = 1; s <= (n + 1) / 2 - k; s++)
            {
                Console.Write(" ");
            }

            for (int l = 1; l <= 2*k-1; l++)
            {
                Console.Write("*");
            }
            Console.WriteLine();
        }


    }
}